package com.ruoyi.shopping.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.coupons.domain.Coupons;
import com.ruoyi.store.domain.Store;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shopping.mapper.MallCouponsMapper;
import com.ruoyi.shopping.domain.MallCoupons;
import com.ruoyi.shopping.service.IMallCouponsService;

/**
 * 优惠券Service业务层处理
 *
 * @author ruoyi
 * @date 2022-06-09
 */
@Service
public class MallCouponsServiceImpl implements IMallCouponsService
{
    @Autowired
    private MallCouponsMapper mallCouponsMapper;

    /**
     * 查询优惠券
     *
     * @param id 优惠券主键
     * @return 优惠券
     */
    @Override
    public MallCoupons selectMallCouponsById(Long id)
    {
        return mallCouponsMapper.selectMallCouponsById(id);
    }

    /**
     * 查询优惠券列表
     *
     * @param mallCoupons 优惠券
     * @return 优惠券
     */
    @Override
    public List<MallCoupons> selectMallCouponsList(MallCoupons mallCoupons)
    {
        return mallCouponsMapper.selectMallCouponsList(mallCoupons);
    }

    /**
     * 新增优惠券
     *
     * @param mallCoupons 优惠券
     * @return 结果
     */
    @Override
    public int insertMallCoupons(MallCoupons mallCoupons)
    {
        mallCoupons.setCreateTime(DateUtils.getNowDate());
        return mallCouponsMapper.insertMallCoupons(mallCoupons);
    }

    /**
     * 修改优惠券
     *
     * @param mallCoupons 优惠券
     * @return 结果
     */
    @Override
    public int updateMallCoupons(MallCoupons mallCoupons)
    {
        mallCoupons.setUpdateTime(DateUtils.getNowDate());
        return mallCouponsMapper.updateMallCoupons(mallCoupons);
    }

    /**
     * 批量删除优惠券
     *
     * @param ids 需要删除的优惠券主键
     * @return 结果
     */
    @Override
    public int deleteMallCouponsByIds(Long[] ids)
    {
        return mallCouponsMapper.deleteMallCouponsByIds(ids);
    }


    /**
     * 批量逻辑删除优惠券
     *
     * @param ids 需要删除的优惠券主键
     * @return 结果
     */
    @Override
    public int logicDeleteMallCoupons(Long[] ids,String delType,Long delUser)
    {
        return mallCouponsMapper.logicDeleteMallCoupons(ids,delType,delUser);
    }

    /**
     * 删除优惠券信息
     *
     * @param id 优惠券主键
     * @return 结果
     */
    @Override
    public int deleteMallCouponsById(Long id)
    {
        return mallCouponsMapper.deleteMallCouponsById(id);
    }

    @Override
    public List<MallCoupons> selectCanReceive(MallCoupons coupons) {
        return mallCouponsMapper.selectCanReceive(coupons);
    }

    /**
     *根据id批量查询
     */
    @Override
    public List<MallCoupons> selectMallCouponsByIds(List<Long> couponsIds) {
        return mallCouponsMapper.selectMallCouponsByIds(couponsIds);
    }

    @Override
    public List<MallCoupons> selectMallCouponsTimeout() {
        return mallCouponsMapper.selectMallCouponsTimeout();
    }

    @Override
    public List<MallCoupons> giveOutCoupons(MallCoupons mallCoupons) {
        return mallCouponsMapper.giveOutCoupons(mallCoupons);
    }
}
